import { createAsyncThunk } from '@reduxjs/toolkit'
import { createSlice } from '@reduxjs/toolkit'
import axios from '../../utils/request'

export const list=createAsyncThunk('car/list',async()=>{
    const res=await axios.get('http://localhost:3000/list')
    return res.data
})


const car = createSlice({
    name: 'counter',
    initialState: {
      shop:[]
    },
    reducers: {
      updateNumj:(state)=>{
        state.shop[0].num+=1
      },
      updateNumjian:(state)=>{
        state.shop[0].num-=1
      }
    }
  })
  
  export const { incremented, decremented } = car.actions;
  export default car